package com.jie.mapper;

import com.jie.show.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * Created by IntelliJ IDEA.
 * User: zxm52
 * Date: 2021/6/21
 * Time: 8:45
 */
public interface UserMapper {
    //    @Select("select * from t_user where account = #{account}")（弃用，写到了UserMapper.xml内）
    User getUserByAccount(@Param("account") String account);

    //    @Insert("insert into t_user (name, account, password) values ( #{user.name}, #{user.account}, #{user.password} ) ")
    int register(@Param("user") User user);

//    @Insert("insert into t_user (name, account, password) values ( #{name}, #{account}, #{password} ) ")
//    int register(User user);

    int setTokenToUser(@Param("token") String token, @Param("id") Integer id);

//    @Delete("delete from user where id = #{id1} or id = #{id2} or id = #{id3} or id = #{id4}")
//    int deleteMore(List<Integer> ids);


    int getUserCount();

    List<User> getUserList();

    @Select("select * from login where account = #{account}")
    User selectUserByAccount(String account);

    @Select("select * from login where name = #{name}")
    User selectUserByName(String name);

    @Select("select * from login where phone = #{phone}")
    User selectUserByPhone(String phone);


    List<User> selectUser(@Param("user") User user);

    User updateUser(@Param("user") User user);

    int deleteUser(@Param("idList") Integer[] id);


}
